import globals from 'globals';
import pluginJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPluginPrettier from 'eslint-plugin-prettier';

/** @type {import('eslint').Linter.Config[]} */
export default [
  { files: ['src/**/*.{js,mjs,cjs,ts}'] },
  { languageOptions: { globals: globals.node } },
  pluginJs.configs.recommended,
  ...tseslint.configs.recommended,
  {
    plugins: {
      prettier: eslintPluginPrettier,
    },
    rules: {
      '@typescript-eslint/no-unused-vars': 'warn',
      'no-unused-vars': [
        'warn',
        {
          vars: 'all', // 检查所有变量
          args: 'after-used', // 仅检查函数参数
          ignoreRestSiblings: true, // 忽略解构的剩余元素
          varsIgnorePattern: '^_', // 忽略以 _ 开头的常量
        },
      ],
      '@typescript-eslint/no-explicit-any': 'warn',
    },
  },
];
